asm
  ld sp,$E7FF
  end asm

#include "./library/smsrnd.bas"
#include "./library/pacmandelay.bas"

dim eee as uinteger at $E010
dim seed as uinteger at $E012
dim ee0 as uinteger at $E014
dim ee1 as uinteger at $E016
dim ee2 as uinteger at $E018
dim ee3 as ubyte at $E01A
dim ecsp as ubyte at $E01C
dim ecsq as ubyte at $E01E
dim ex0 as uinteger at $E020
dim ey0 as uinteger at $E022


sub sauroputchar(txp1 as uinteger,typ1 as uinteger,tch1 as ubyte,tat1 as ubyte,tla1 as uinteger)
  poke $F000+($800*(tla1 band 1))+(txp1*32)+typ1,tch1
  poke $F400+($800*(tla1 band 1))+(txp1*32)+typ1,tat1
  end sub

'sub sauroputsprite(tla1 as uinteger,txp1 as byte, typ1 as ubyte, tch1 as ubyte,tat1 as ubyte)
'  end sub



seed=0

for ee0=0 to 31
  for ee1=0 to 31
    seed=smsrnd(seed):ee2=seed:seed=smsrnd(seed)
    sauroputchar(ee1,ee0,ee2 band $0F,seed band $FC,0)
    next:next

for ee0=0 to 15
  for ee1=0 to 15
    sauroputchar(ee1+14,ee0+13,ee0*16+ee1,0,0)
    next:next


ex0=8:ey0=4
eee=0
do

sauroputchar(ex0,ey0,eee,0,0)

sauroputchar(2,3,48+(int(eee/100) mod 10),0,0)
sauroputchar(3,3,48+(int(eee/10) mod 10),0,0)
sauroputchar(4,3,48+(eee mod 10),0,0)

ee1=in($00)
sauroputchar(2,5,48+(int(ee1/100) mod 10),0,0)
sauroputchar(3,5,48+(int(ee1/10) mod 10),0,0)
sauroputchar(4,5,48+(ee1 mod 10),0,0)

ee1=in($20)
sauroputchar(2,6,48+(int(ee1/100) mod 10),0,0)
sauroputchar(3,6,48+(int(ee1/10) mod 10),0,0)
sauroputchar(4,6,48+(ee1 mod 10),0,0)

ee1=in($40)
sauroputchar(2,7,48+(int(ee1/100) mod 10),0,0)
sauroputchar(3,7,48+(int(ee1/10) mod 10),0,0)
sauroputchar(4,7,48+(ee1 mod 10),0,0)

ex0=ex0-((ee1 band 16)/16)+((ee1 band 32)/32)
ey0=ey0-((ee1 band 64)/64)+((ee1 band 128)/128)


ee1=in($60)
sauroputchar(2,8,48+(int(ee1/100) mod 10),0,0)
sauroputchar(3,8,48+(int(ee1/10) mod 10),0,0)
sauroputchar(4,8,48+(ee1 mod 10),0,0)



eee=eee+1
pacmandelay(5000)
loop



do:loop

'--------------------------------------------------

do

  for eee=$F800 to $FBFF '- fg chr
    seed=smsrnd(seed)
    poke eee,seed
    pacmandelay(5000)
    next

  for eee=$FC00 to $FFFF '- fg attr
    seed=smsrnd(seed)
    poke eee,seed
    pacmandelay(5000)
    next

loop

do

  for eee=$F000 to $F3FF '- bg chr
    seed=smsrnd(seed)
    poke eee,seed
    pacmandelay(5000)
    next

  for eee=$F400 to $F7FF '- bg attr
    seed=smsrnd(seed)
    poke eee,seed
    pacmandelay(5000)
    next

loop



do


  for eee=$E800 to $EBFF '- sprite
    seed=smsrnd(seed)
    poke eee,seed
    'pacmandelay(100)
    next

  loop

do:loop


for eee=$E800 to $FFFF
  seed=smsrnd(seed)
  poke eee,seed
  next


'e800-ebff   Sprite RAM
'f000-fbff   Background Video RAM
'f400-ffff   Background Color RAM
'f800-fbff   Foreground Video RAM
'fc00-ffff   Foreground Color RAM



